//
//  PTHandler.h
//  pintu
//
//  Created by Fxxx on 2017/11/29.
//  Copyright © 2017年 lu. All rights reserved.
//

#import <UIKit/UIKit.h>

@class PTHandler;

typedef NS_ENUM(NSInteger ,PTLevel) {
    PT3X3 = 3, PT4X4, PT5X5,
};

@protocol PTHandlerDelegate <NSObject>

- (void)handlerImages:(NSArray <UIImage *>*)images didChangeIndexes:(NSArray <NSNumber *>*)indexes;
@end

@interface PTHandler : NSObject

- (PTHandler *)initWithImage:(UIImage *)image
                       level:(PTLevel)level
                    delegate:(id<PTHandlerDelegate>)delegate;

@property (assign ,nonatomic ,readonly) PTLevel level;

@property (strong ,nonatomic ,readonly) UIImage *image;
@property (strong ,nonatomic ,readonly) NSArray <UIImage *>*images;
@property (strong ,nonatomic ,readonly) NSArray <NSNumber *>*indexes;


/**
 * 打乱拼图索引顺序,会触发didChangeIndexes代理方法
 */
- (void)upset;


/**
 * 更新拼图索引顺序,会触发didChangeIndexes代理方法

 @param index 点击的位置
 */
- (void)update:(NSInteger)index;
@end
